<?php

/**
 * Recuit form base class.
 *
 * @method Recuit getObject() Returns the current form's model object
 *
 * @package    appcemhti
 * @subpackage form
 * @author     Steve Cancès
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseRecuitForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_traitement'          => new sfWidgetFormInputHidden(),
      'id_controle_atmosphere' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ControleAtmosphere'), 'add_empty' => true)),
      'tempmax'                => new sfWidgetFormInputText(),
      'rampe_montee'           => new sfWidgetFormInputText(),
      'rampe_descente'         => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id_traitement'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_traitement')), 'empty_value' => $this->getObject()->get('id_traitement'), 'required' => false)),
      'id_controle_atmosphere' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ControleAtmosphere'), 'required' => false)),
      'tempmax'                => new sfValidatorNumber(array('required' => false)),
      'rampe_montee'           => new sfValidatorNumber(array('required' => false)),
      'rampe_descente'         => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('recuit[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Recuit';
  }

}
